#include <iostream>

using namespace std;

class Solution {
public:
    int titleToNumber(string s) {
        int number = 0;
        for (char character : s) {
            number *= 26;
            number += character - '@';
        }
        return number;
    }
};

int main() {
    Solution solution;
    int number = solution.titleToNumber("AB");
    cout << number << endl;
    return 0;
}
